import 'package:backend.core/core/domain/entities/api/google_play/api_google_play_purchased_item_acknowledgement_status.dart';
import 'package:equatable/equatable.dart';

const kApiGooglePlayPurchasedItemAcknowledgedAcknowledgementStatusValue = 'acknowledged';
const kApiGooglePlayPurchasedItemYetToBeAcknowledgedAcknowledgementStatusValue =
    'yet_to_be_acknowledged';
const kApiGooglePlayPurchasedItemUnacknowledgeableAcknowledgementStatusValue = 'unacknowledgeable';

class ApiGooglePlayPurchasedItemAcknowledgementStatusDto extends Equatable {
  const ApiGooglePlayPurchasedItemAcknowledgementStatusDto._internal({
    required this.acknowledgementStatusString,
  });

  final String acknowledgementStatusString;

  @override
  List<Object?> get props {
    return [
      acknowledgementStatusString,
    ];
  }

  factory ApiGooglePlayPurchasedItemAcknowledgementStatusDto.fromEntity(
      ApiGooglePlayPurchasedItemAcknowledgementStatus acknowledgementStatus) {
    late final String acknowledgementStatusString;

    if (acknowledgementStatus == ApiGooglePlayPurchasedItemAcknowledgementStatus.acknowledged) {
      acknowledgementStatusString =
          kApiGooglePlayPurchasedItemAcknowledgedAcknowledgementStatusValue;
    } else if (acknowledgementStatus ==
        ApiGooglePlayPurchasedItemAcknowledgementStatus.yetToBeAcknowledged) {
      acknowledgementStatusString =
          kApiGooglePlayPurchasedItemYetToBeAcknowledgedAcknowledgementStatusValue;
    } else if (acknowledgementStatus ==
        ApiGooglePlayPurchasedItemAcknowledgementStatus.unacknowledgeable) {
      acknowledgementStatusString =
          kApiGooglePlayPurchasedItemUnacknowledgeableAcknowledgementStatusValue;
    }

    return ApiGooglePlayPurchasedItemAcknowledgementStatusDto._internal(
      acknowledgementStatusString: acknowledgementStatusString,
    );
  }

  @override
  String toString() {
    return acknowledgementStatusString;
  }
}
